package com.gbas.comu.servlet.struts;

import com.gbas.comu.dao.DaoService;
import com.gbas.comu.model.*;
import com.gbas.comu.service.JugadorService;
import com.gbas.comu.util.Util;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.MappingDispatchAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class JugadorActions extends MappingDispatchAction {
    public ActionForward show(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse response) throws Exception {
        httpServletRequest.setAttribute("jugadores", DaoService.getJugadorDAO().findAll());
        return actionMapping.findForward("success");
    }

    public ActionForward create(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse response) throws Exception {
        JugadorService.createJugador();
        return actionMapping.findForward("success");
    }

}
